#!/bin/bash
source src/conf/config.conf

cd $tftp_dir
wget -c  ibook/esx.tar.gz

#wget -c  http://pxe.sytes.net/esx.tar.gz

cat > /etc/apt/sources.list << EOF

# PVE packages provided by proxmox.com
deb http://download.proxmox.com/debian wheezy pve

# security updates
deb http://security.debian.org/ wheezy/updates main contrib
EOF 


cat > pxelinux.cfg/others << EOF
default vesamenu.c32
prompt 0
timeout 0
menu title ProxMox VE
menu include pxelinux.cfg/graphics.conf


EOF

wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -
wget -c  proxmox.tar.gz

apt-get install pve-firmware pve-kernel-2.6.32-20-pve
        tar -xzvf proxmox.tar.gz ./proxmox/


mkdir tars
mv proxmox.tar.gz tars/
yes | cp -Rv _proxmox/* proxmox/
rm -r _proxmox

cat > /pxelinux.cfg/others << EOF

label ProxMox VE Default
kernel linux26
APPEND vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 initrd=initrd.img rw quiet splash=silent
 
label ProxMox VE PVE Version
kernel linux26
APPEND ramdisk_size=16777216 initrd=initrd.img root=/dev/mapper/pve-root
EOF




cat >> pxelinux.cfg/others << EOF 
menu include pxelinux.cfg/graphics.conf
MENU BACKGROUND pxelinux.cfg/background.png
UI http://<HTTP Server name or IP>/boot/menu.c32
 
LABEL Proxmox
    MENU LABEL Proxmox
    LINUX http://<HTTP Server name or IP>proxmox/linux26
    APPEND vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 
    INITRD http://<HTTP Server name or IP>proxmox/initrd.img splash=verbose


MENU LABEL ProxMox (latest)
    KERNEL proxmox/linux26
    APPEND ramdisk_size=524288 vga=791 video=vesafb:ywrap,mtrr splash=verbose
    INITRD proxmox/initrd.iso.img

EOF

